package com.ydy.threadpool.task;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ydy.service.email.EmailService;
import com.ydy.vo.email.EmailVo;

public class SendEmailTask implements Runnable {

	private final static Logger log = LoggerFactory.getLogger(SendEmailTask.class);
	private EmailVo emailVo;
	private EmailService emailService;

	public SendEmailTask(EmailVo emailVo, EmailService emailService) {
		this.emailVo = emailVo;
		this.emailService = emailService;
	}

	@Override
	public void run() {
		if (this.emailVo == null)
			return;
		log.info("发送邮件开始");
		long start = System.currentTimeMillis();
		emailService.sendHtmlMail(emailVo, true);
		log.info("发送邮件结束,耗时 {} ms", System.currentTimeMillis() - start);

	}

}
